const express = require('express')
const path = require('path')
const cookieParser = require('cookie-parser')
const session = require('express-session')
const router = require('./routes')
const bodyParser = require('body-parser')
const user = require('./routes/user')


const app = express()
app.set('view engine','ejs')
app.use(bodyParser.urlencoded({extended:false}))
app.use(bodyParser.json())
app.use(express.static(path.join(__dirname,'./public')))
app.use(cookieParser())
app.use(session({
    secret:'12390876',
    cookie:{
        expires:1000*60*1
    },
    resave:false,
    saveUninitialized:false
}))


app.use('/user',user)

app.get('/',(req,res)=>{
    res.redirect('/index')
})
app.use('/index',router)



app.listen(3003,()=>{
    console.log(`服务已启动...3003`);
})